app:registClass("NewDungeonTypeController", "app.team.controllers.NewDungeonTypeController")
app:registClass("NewTeamReadyAndSettingController", "app.team.controllers.NewTeamReadyAndSettingController")
app:registClass("NewTeamApplyController", "app.team.controllers.NewTeamApplyController")
app:registClass("NewTeamMemberController", "app.team.controllers.NewTeamMemberController")
app:registClass("NewTeamSettingController", "app.team.controllers.NewTeamSettingController")
app:registClass("TeamMatchController", "app.team.controllers.TeamMatchController")
app:registClass("TeamMatchCrossController", "app.team.controllers.TeamMatchCrossController")

local TeamModel = import(".models.TeamModel")
TeamModel = import(".models.TeamModel_match")
app:registInst(TeamModel.new())

app:registInst(app:getClass("NewDungeonTypeController").new({type="systemUI"}))
app:registInst(app:getClass("TeamMatchController").new({type="systemUI"}))
app:registInst(app:getClass("TeamMatchCrossController").new({type="systemUI"}))
app:registInst(app:getClass("NewTeamReadyAndSettingController").new({type="systemUI"}))
app:registInst(app:getClass("NewTeamApplyController").new({type="systemUI"}))
app:registInst(app:getClass("NewTeamMemberController").new({type="systemUI"}))
app:registInst(app:getClass("NewTeamSettingController").new({type="systemUI"}))

local model = app:getInst("TeamModel")

--------------------------------------------------------------------------------------->>>>>> 新队伍相关协议
-- 队伍信息更新
app.session:on("pb_team.S2C_TeamInfoUpdate",function(ret)
	model:S2C_TeamInfoUpdate(ret)
end)

-- 投票广播，队长无需响应
app.session:on("pb_team.S2C_TeamReadyNotify",function(ret)
	model:onTeamNewVote(ret)
end)
-- 取消投票
app.session:on("pb_team.S2C_TeamCancelNotify",function(ret)
    model:onCancelVote(ret)
end)
-- 投票确认结束
app.session:on("pb_team.S2C_ConfirmTeamReadyNotify",function(ret)
	model:onConfirmVote(ret)
end)


-- 收到邀请
app.session:on("pb_team.S2C_TeamInvitation",function(ret)
	model:onTeamNewBeingInvited(ret)
end)
-- 发出去的组队邀请反馈
app.session:on("pb_team.S2C_InviteFeedBack",function(ret)
	model:onInvitationFeedBack(ret)
end)

app.session:on("pb_team.S2C_RejectChangeTeamLeaderApply", function(ret)
    if ret.ok then
       display.pushToast(L("team_text7"))
    end
end)


-- 入队申请
app.session:on("pb_team.S2C_TeamApplication",function(ret)
	model:onTeamNewApplication(ret)
end)
-- 发送给入队申请人的，队长拒绝入队通知
app.session:on("pb_team.S2C_RejectApplication",function(ret)
	model:onApplicationBeRejected(ret)
end)

app.session:on("pb_team.S2C_ChangeTeamLeaderInfo", function(ret)
    model:onImpeachCaptainRequest(ret)
end)

-- 收到队长跟随邀请
app.session:on("pb_team.S2C_InviteTeamFollowLeader", function(ret)
    model:S2C_InviteTeamFollowLeader(ret)
end)

-- 收到队员跟随邀请回复
app.session:on("pb_team.S2C_ReplyTeamFollowLeaderNotice", function(ret)
    model:S2C_ReplyTeamFollowLeaderNotice(ret)
end)


-- 副本匹配开始
app.session:on("pb_team.S2C_StartTeamTargetMatchNotify", function(ret)
    model:S2C_StartTeamTargetMatchNotify(ret)
end)
-- 副本匹配结束
app.session:on("pb_team.S2C_FinishTeamTargetMatchNotify", function(ret)
    model:S2C_FinishTeamTargetMatchNotify(ret)
end)
-- 副本匹配恢复
app.session:on("pb_team.S2C_RecoverDungeonMatch", function(ret)
    model:S2C_RecoverDungeonMatch(ret)
end)


-- 竞速副本结算
app.session:on("pb_speeddungeon.S2C_SpeedDungeonResult",function(ret)
    model:S2C_SpeedDungeonResult(ret)
end)

-- 跨服匹配信息修改
app.session:on("pb_cross.S2C_MatchNotify",function(ret)
    model:S2C_MatchNotify(ret)
end)

-- 跨服匹配成功
app.session:on("pb_cross.S2C_CrossDungeonMatchSuccessNotify",function(ret)
    model:S2C_CrossDungeonMatchSuccessNotify(ret)
end)

-- 跨服匹配成功后被中断
app.session:on("pb_cross.S2C_CrossDungeonMatchReadyCancelNotify",function(ret)
    model:S2C_CrossDungeonMatchReadyCancelNotify(ret)
end)
